/**
 * index 页面的仓库
 * state:属性
 * mutations:方法
 */
import { action } from "mobx-miniprogram";

const state = {
  searchValue: '',
  loadingSts: false,
  goodsTypeValue1: 0,
  goodsTypeValue2: 0,
  goodsTypeOption1: [
    { text: '全部商品', value: 0 },
    { text: '新款商品', value: 1 },
    { text: '活动商品', value: 2 },
  ],
  goodsTypeOption2: [
    { text: '默认', value: 0 },
    { text: '好评', value: 1 },
    { text: '销量', value: 2 },
    { text: '价格', value: 3 },
  ],
}


const mutations = {
  onChangeSearch: action(function (val) {
    console.log(val);
    this.searchValue = val.detail
  }),
  onChangeLoadingSts: action(function (val) {
    console.log(val);

    this.loadingSts = val
  }),
}

export default {
  ...state,
  ...mutations
}